package com.yanqu.road.server.cmd.system;

import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.server.command.Cmd;

@Cmd(code = Protocol.S_SERVER_SHUTDOWN, desc = "服务器停服维护")
public class ShutdownServerCmd extends AbstractCommand {


    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        Thread.sleep(30000);
        log.error("GameServer后台关闭服务器");
        GameServer.getInstance().stop();
        Runtime.getRuntime().exit(0);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
